﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ExpenseSystem.Model;
using ExpenseSystem.Lor;
using ExpenseSystem.Common;
using ExpenseSystem.DataUpdater;
using ExpenseSystem.Fether;
using ExpenseSystem.Core.DataAddOn;

namespace ExpenseSystem.Core.QuoteModules
{
    public class SalesPointQuoteBaseManager:SalesPointQuoteManager
    {
        SalesPointQuoteFetcher fetcher = new SalesPointQuoteFetcher();
        public override bool Delete(SalesPointQuoteModel SalesPointQuote, out string message)
        {
            if (SalesPointQuote.Site != profile.SiteId)
            {
                message = "当前登录的组织与档案所在组织不一致";
                return false;
            }
            bool result = SalesPointQuoteUpdater.Remove(SalesPointQuote, tran, fetcher, out message);
            return result;
        }

        public override bool DeleteById( long[] SalesPointQuoteIds, out string message)
        {
            bool result = true;
            result = SalesPointQuoteUpdater.RemoveById( profile.SiteId, SalesPointQuoteIds, tran, fetcher, out message);
            return result;
        }

        public override bool Save( SalesPointQuoteModel SalesPointQuote, out string message, params IAddable<SalesPointQuoteModel>[] addable)
        {
            if (SalesPointQuote.Site != profile.SiteId)
            {
                message = "当前登录的组织与档案所在组织不一致";
                return false;
            }
            bool result = true;
            result = SalesPointQuoteUpdater.Save( SalesPointQuote, tran, fetcher, out message);
            return result;
        }
    }
}
